import { defineAsyncComponent } from "vue";

// 动态加载
const req = import.meta.glob("@/config/*.vue"); // 组件

const components = Object.entries(req).reduce(
  (components, [path, resolver]) => {
    const name = path.match(/([^/]+)\.vue$/)[1];

    components[name] = defineAsyncComponent(resolver); // 定义异步组件

    return components;
  },
  {}
);

export {
  components
}
